package tests.steps;

import net.thucydides.core.annotations.Step;
import net.thucydides.core.pages.Pages;
import net.thucydides.core.steps.ScenarioSteps;
import tests.pages.LoginPage;
import tests.pages.RecentActivityPage;

public class EndUserSteps extends ScenarioSteps {


    public EndUserSteps(Pages pages) {
        super(pages);
    }

    @Step
    public void connect() {
        onLoginPage().btnConnecnt_Fb();
    }


    @Step
    public void inputEmail(String email) {
        onLoginPage().email_terms(email);
    }
    @Step
    public void inputPass(String pass) {
        onLoginPage().passwordValue(pass);
    }
    @Step
    public void login() {
        onLoginPage().login();
    }
    @Step
    public void checkPage(String word) {
        RecentPage().RecentElementt(word);
    }

    private LoginPage onLoginPage() {
        return getPages().currentPageAt(LoginPage.class);
    }

    // private LoginPage LoginPage() {
    //  return getPages().currentPageAt(LoginPage.class);
    // }

    private RecentActivityPage RecentPage(){
        return getPages().currentPageAt(RecentActivityPage.class);
    }

    @Step
    public void is_the_opening_page() {
        onLoginPage().open();
    }

    @Step
    public void connect_sigin(String email,String pass) {
        connect();
        inputEmail(email);
        inputPass(pass);
        login();

    }
    @Step
    public void  should_opening_page(String word){
        //public void  should_opening_page(String world){
        //  assertThat(DictionaryPage().getDefinitions(),hasItem(world));
        // assertThat(RecentPage().isElementVisible(By.className("greeting")), is(true));
        RecentPage().getTitle();
        checkPage(word);

    }
}
